package principle.liskovSubstitutionPrinciple.perfection;

import lombok.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.math.BigDecimal;

/**
 * @author： pang-yun
 * @date： 2021-08-24 21:00
 * 功能目的 ：用于
 */

@Setter
@Getter
public class CashCard extends BankCard{

    private Logger logger= LoggerFactory.getLogger(CashCard.class);

    public CashCard(int cardNo, String cardDate) {
        super(cardNo, cardDate);
    }

    /**
     * 规则过滤  储蓄卡直接默认通过
     * @param amount
     * @return
     */
    @Override
    boolean rule(BigDecimal amount) {
        return true;
    }

    public String withdrawal(int orderId,BigDecimal amount){
        // TODO  模拟支付
        return super.negative(orderId,amount);
    }

    public String recharge(int orderId,BigDecimal amount){
        // TODO  储蓄
        return super.positive(orderId,amount);
    }


    public boolean checkRisk(int cardNo,int orderId,BigDecimal amount){
        // 风险评估
        logger.info("风险评估！");
        return true;
    }
}
